#ifndef AVALON_SIZEDECLARATIVEWRITER_HPP
#define AVALON_SIZEDECLARATIVEWRITER_HPP
#include "Avalon/Base/Handle.hpp"
#include "Avalon/IO/Writer.hpp"

namespace Avalon {
namespace IO {

  /*! \class SizeDeclarativeWriter
   *  \brief Writes to a destination, declaring the size to be written.
   *  \author Kamal Mansouri <kranar@hotmail.com>
   */
  class SizeDeclarativeWriter : public Writer {
    public:

      //! Constructs a SizeDeclarativeWriter.
      /*!
        \param destination The destination of all write operations.
      */
      SizeDeclarativeWriter(Carry<Writer> destination);

      virtual ~SizeDeclarativeWriter();

      virtual Threading::Async<void>::Ptr Write(const void* data, int size);

      virtual Threading::Async<void>::Ptr Write(const Buffer& data);

    private:
      Handle<Writer> m_destination;
  };
}
}

#endif // AVALON_SIZEDECLARATIVEWRITER_HPP
